cmake_minimum_required(VERSION 3.8)
project(core)

set(CMAKE_CXX_STANDARD 20)

if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
  add_compile_options(-Wall -Wextra -Wpedantic)
endif()

# find dependencies
find_package(ament_cmake REQUIRED)
find_package(rclcpp REQUIRED)
find_package(rclcpp_action REQUIRED)
find_package(rclcpp_lifecycle REQUIRED)
find_package(std_msgs REQUIRED)
find_package(nav_msgs REQUIRED)
find_package(general_interface REQUIRED)

add_executable(test_core src/test.cpp)
ament_target_dependencies(test_core rclcpp rclcpp_action general_interface)
install(TARGETS test_core RUNTIME DESTINATION lib/${PROJECT_NAME})

add_executable(core 
  src/main.cpp
  src/core.cpp
  src/context.cpp
  src/follow_path_task.cpp
  src/state_servo_task.cpp
  src/balance_task.cpp
  src/idel_task.cpp)
target_include_directories(core PRIVATE include)
ament_target_dependencies(core rclcpp rclcpp_action rclcpp_lifecycle nav_msgs general_interface)
install(TARGETS core RUNTIME DESTINATION lib/${PROJECT_NAME})

# Install launch files
install(
  DIRECTORY launch/
  DESTINATION share/${PROJECT_NAME}/launch
)

ament_package()
